Row

Tmax against tmin

Row

Tmax Distribution of each year

Snowfall Distribution of each year

---
title: "NOAA Dashboard without Shiny"
output: 
  flexdashboard::flex_dashboard:
    source_code: embed
    vertical_layout: fill
---

```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(janitor)
library(stringr)
library(forcats)
library(viridis)
library(plotly)
library(shiny)
library(httr)
library(jsonlite)
```

-----------------------------------------------------------------------

```{r}
noaa<- read_csv("nynoaadat.zip") 

```


Row
-----------------------------------------------------------------------

### Tmax against tmin

```{r}
hexplot = filter(noaa, !is.na(tmax))%>%
  filter(!is.na(tmin))%>%
  mutate(tmax = as.numeric(tmax))%>%
  mutate(tmin = as.numeric(tmin))%>%
ggplot(aes(tmin, tmax)) +
  geom_hex()+
   labs(
    x = "Minimum temperature (tenths of degrees C)",
    y = "Maximum temperature (tenths of degrees C)",
    caption = "ny_noaa_data_year"
  ) + 
  theme_classic()
ggplotly(hexplot)

```

Row {.tabset .tabset-fade}
-----------------------------------------------------------------------

### Tmax Distribution of each year
```{r}
noaa<- separate(noaa,date, into = c("year", "month","day"), sep = "-")
  noaa<- noaa %>%
    group_by(year)
noaa$tmax<- as.numeric(noaa$tmax)
hist<- ggplot(noaa, aes(x =tmax , fill = year)) + 
  geom_histogram(alpha= 0.8) +
  labs(x = "Maximum temperature (tenths of degrees C)", y = "Number")

ggplotly(hist)

```


### Snowfall Distribution of each year

```{r}
ny_noaa_data_snowfall =
  filter(noaa, snow > 0 & snow < 100)%>%
  ggplot(aes(x = year, y = snow, fill = year, color = year)) + 
  geom_violin()+ 
  labs(
    x = "year",
    y = "snowfall(mm)",
    caption = "Data from ny_noaa_data"
  ) + 
  theme(axis.text.x=element_text(angle=90,hjust=1)) + 
  theme(legend.position = "bottom")
ggplotly(ny_noaa_data_snowfall)
```